Skip to content

Conversation

@RishikaGhosh
Copy link

Description

Converts all synchronous integration tests to asynchronous tests across the langchain-google repository to enable parallel test execution with pytest-xdist.

Fixes #960

Changes Made

Infrastructure

  • Added pytest-xdist>=3.8.0,<4.0.0 to test dependencies in genai and community packages
  • Updated Makefiles to use -n auto flag for parallel test execution

Test Conversions

Genai Package (~20+ tests)

  • test_chat_models.py: All chat model tests
  • test_llms.py: All LLM tests
  • test_embeddings.py: All embedding tests
  • test_callbacks.py: Streaming callback tests
  • test_tools.py: Tool tests
  • test_function_call.py: Function call tests

Vertexai Package (~30+ tests)

  • test_chat_models.py: 37+ chat model tests
  • test_llms.py: All LLM tests
  • test_embeddings.py: All embedding tests
  • test_callbacks.py: All callback tests
  • test_chains.py: All chain tests
  • test_evaluation.py: All evaluation tests + added aevaluate() method
  • test_llms_safety.py: Safety tests
  • test_maas.py: MaaS model tests
  • test_model_garden.py: All model garden tests (9 tests)
  • test_vision_models.py: Vision model tests
  • test_vectorstores.py: Vector store tests
  • test_anthropic_files.py: Anthropic file tests

Community Package (2 tests)

  • test_check_grounding.py: Grounding check test
  • test_rank.py: Ranking retriever test

Testing

All tests have been converted following the async pattern:

  • def test_...async def test_...
  • .invoke()await .ainvoke()
  • .generate()await .agenerate()
  • .stream()async for .astream()
  • And similar async conversions for embeddings, document storage, and vector store operations

Benefits

  • ✅ Enables parallel test execution with pytest-xdist
  • ✅ Significantly improves integration test performance
  • ✅ Maintains test functionality while improving efficiency
  • ✅ All tests remain compatible with pytest-asyncio

Rishika Ghosh added 5 commits November 20, 2025 00:38
- Add pytest-xdist>=3.8.0,<4.0.0 to test dependencies in genai and community packages
- Update Makefiles to use -n auto flag for parallel test execution
- This enables faster integration test runs using multiple workers
- Convert all synchronous integration tests to async in genai package
- Update test_chat_models.py: 20+ tests converted to async
- Update test_llms.py: all tests converted to async
- Update test_embeddings.py: all tests converted to async
- Update test_callbacks.py: streaming callback test converted to async
- Update test_tools.py: tool tests converted to async
- Update test_function_call.py: all function call tests converted to async
- This enables parallel test execution with pytest-xdist for improved performance
- Convert all synchronous integration tests to async in vertexai package
- Update test_chat_models.py: 37+ tests converted to async
- Update test_llms.py: all tests converted to async
- Update test_embeddings.py: all tests converted to async
- Update test_callbacks.py: all callback tests converted to async
- Update test_chains.py: all chain tests converted to async
- Update test_evaluation.py: all evaluation tests converted to async
  - Add aevaluate() method to VertexStringEvaluator class for async batch evaluation
- Update test_llms_safety.py: safety tests converted to async
- Update test_maas.py: MaaS model tests converted to async
- Update test_model_garden.py: all model garden tests converted to async
- Update test_vision_models.py: vision model tests converted to async
- Update test_vectorstores.py: vector store tests converted to async
- Update test_anthropic_files.py: Anthropic file tests converted to async
- This enables parallel test execution with pytest-xdist for improved performance
- Convert synchronous integration tests to async in community package
- Update test_check_grounding.py: grounding check test converted to async
- Update test_rank.py: ranking retriever test converted to async
- This enables parallel test execution with pytest-xdist for improved performance
@RishikaGhosh RishikaGhosh changed the title Fix/async integration tests 960 -feat integration tests 960 Nov 19, 2025
@RishikaGhosh RishikaGhosh changed the title -feat integration tests 960 - feat Making integration tests async #960 Nov 19, 2025
@RishikaGhosh RishikaGhosh changed the title - feat Making integration tests async #960 feat Making integration tests async #960 Nov 19, 2025
@RishikaGhosh RishikaGhosh reopened this Nov 19, 2025
@RishikaGhosh RishikaGhosh changed the title feat Making integration tests async #960 chore(genai,vertexai,community): Making integration tests async #960 Nov 19, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Improvements: Integration tests should be async

1 participant